Skip to content

feat(azure-devops): block and trigger#4664

Merged
waleedlatif1 merged 24 commits into
stagingfrom
feat/azure-devops-integration
May 19, 2026
Merged

feat(azure-devops): block and trigger#4664
waleedlatif1 merged 24 commits into
stagingfrom
feat/azure-devops-integration

Conversation

@waleedlatif1
Copy link
Copy Markdown
Collaborator

@waleedlatif1 waleedlatif1 commented May 19, 2026

Summary

Pulls in @mzxchandra's Azure DevOps integration from #4642, rebases onto staging, and applies validate-integration fixes.

Supersedes #4642 (which targeted a fork branch — this PR carries the rebased commits on origin so it can be merged through the normal flow).

Validate-integration fixes applied on top of #4642

  • Brand color: bgColor switched from #FFFFFF to Azure DevOps blue #0078D4 in both block and docs BlockInfoCard — the white-on-light theme was unreadable.
  • WIQL hydration correctness: query_work_items previously sliced to the first 200 IDs and silently dropped the rest. It now chunks the matched IDs into batches of 200 and hydrates all matches. Added an HTTP status check on the follow-up fetch so a 401/403 from the second call surfaces a clear error instead of producing empty rows. New totalMatched field in metadata reports the pre-hydration count.
  • Trim org/project: query_work_items URL now trims organization/project to avoid copy-paste whitespace 404s.
  • Manual description: added {/* MANUAL-CONTENT-START:intro */} block to azure_devops.mdx with audience-facing description and use cases (matches the convention used by other tool docs, e.g. box.mdx).
  • Tests updated for new chunking behavior and update-work-item validation; all 20 tool tests + 6 block tests pass.

What's included (from #4642)

16 tools across pipelines, builds, and work-item tracking; single azure_devops block; 2 webhook triggers (build.complete failed/canceled/partial, workitem.created). PAT auth via HTTP Basic. Targets Azure DevOps Services (cloud), API version 7.2.

Test plan

  • bun vitest run tools/azure_devops/azure-devops.test.ts → 20 passed
  • bun vitest run blocks/blocks/azure_devops.test.ts → 6 passed
  • bun run check:api-validation passes
  • Manual: create a workflow that runs azure_devops_query_work_items with a WIQL returning >200 rows; verify all rows hydrate

mzxchandra and others added 17 commits May 19, 2026 12:20
Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>
Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>
Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>
- bgColor switched from white to Azure DevOps brand color #0078D4 (block + mdx)
- WIQL query_work_items: hydrate ALL matched IDs by chunking through batches
  of 200 instead of silently truncating; check response.ok on the follow-up
  fetch and surface a clear error on 4xx/5xx; trim org/project; expose
  totalMatched in metadata so users can see pre-hydration count
- Add MANUAL-CONTENT-START:intro section to the azure_devops.mdx docs page
- Update unit tests for new chunking behavior and update-work-item validation

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
@vercel
Copy link
Copy Markdown

vercel Bot commented May 19, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
Project Deployment Actions Updated (UTC)
docs Skipped Skipped May 19, 2026 9:09pm

Request Review

@cursor
Copy link
Copy Markdown

cursor Bot commented May 19, 2026

PR Summary

Medium Risk
Introduces a new Azure DevOps integration surface (block, 16 tools, and webhook provider) plus UI/docs wiring; moderate risk due to new external API interactions and webhook event handling, though scoped and covered by tests.

Overview
Adds a new Azure DevOps integration end-to-end: a azure_devops block with an operation dropdown, PAT-based auth, typed inputs/outputs, and trigger support; plus 16 new tools covering pipelines/runs, builds/logs/timelines, WIQL work item querying (with >200 result chunked hydration), work item CRUD, and comments.

Wires the integration into the product and docs surfaces by adding an AzureDevOpsIcon, updating icon mappings and integrations.json, registering the block and webhook provider (azure_devops_build_failed, azure_devops_work_item_created, and a pass-through webhook trigger), and adding new docs pages + meta entries for tools/triggers. Includes comprehensive vitest coverage for tool request/response contracts, chunking/error handling, and block/tool-id routing.

Reviewed by Cursor Bugbot for commit 41b172f. Configure here.

Comment thread apps/sim/app/(landing)/integrations/data/integrations.json Outdated
Comment thread apps/sim/app/(landing)/integrations/data/integrations.json
@greptile-apps
Copy link
Copy Markdown
Contributor

greptile-apps Bot commented May 19, 2026

Greptile Summary

This PR adds a full Azure DevOps integration: 16 tools spanning pipelines, builds, and work items; a single azure_devops block; two webhook triggers (build.complete failed/canceled and workitem.created); and PAT-based HTTP Basic auth. It also applies several validate-integration fixes over the base #4642 branch, including chunked WIQL hydration, org/project trimming, and brand-color correction.

  • Tools (apps/sim/tools/azure_devops/): 16 tool files covering the full CRUD surface for pipelines, builds, and work items. query_work_items correctly batches up to 200 IDs per request and checks HTTP status on every secondary fetch; get_work_items_batch mirrors the same pattern.
  • Block (apps/sim/blocks/blocks/azure_devops.ts): Unified block with a dropdown over all 16 tools, normalizeDate for bare YYYY-MM-DD inputs, and correct user-only visibility for the PAT field.
  • Triggers (apps/sim/triggers/azure_devops/): build_failed trigger matches failed, canceled, partiallySucceeded, and stopped results case-insensitively; work_item_created and a passthrough generic webhook trigger are also included.

Confidence Score: 5/5

The integration is safe to merge; all 16 tools, the block, and both triggers are wired up correctly with proper auth and chunked hydration.

The chunked WIQL hydration, org/project trimming, and webhook dispatch logic all look correct. The two findings are both minor inconsistencies (priority stringification and a test coverage gap for the timeline tool) that do not affect runtime correctness of the primary user-facing paths.

apps/sim/tools/azure_devops/update_work_item.ts and create_work_item.ts for the priority serialization inconsistency; apps/sim/tools/azure_devops/azure-devops.test.ts for the missing getBuildTimelineTool surface check.

Important Files Changed

Filename Overview
apps/sim/tools/azure_devops/query_work_items.ts Chunked WIQL hydration with 200-ID batches, HTTP status checks, and organization/project trimming — the core PR fix is correctly implemented.
apps/sim/tools/azure_devops/update_work_item.ts Comprehensive field-update tool; priority is serialized as String(Number(...)) while all other numeric fields correctly send numeric values — inconsistent with the JSON Patch spec for integer fields.
apps/sim/tools/azure_devops/create_work_item.ts New work-item creation tool; same priority stringification pattern as update_work_item.ts — Microsoft.VSTS.Common.Priority is sent as "2" rather than 2 in the JSON Patch body.
apps/sim/tools/azure_devops/azure-devops.test.ts 788-line test suite with good chunk/error-hydration coverage; getBuildTimelineTool is omitted from allTools and expectedIds so the full surface assertion silently misses it.
apps/sim/tools/azure_devops/get_work_items_batch.ts Correctly fetches first chunk via the URL builder and subsequent chunks via manual fetch calls in transformResponse, with proper error handling.
apps/sim/lib/webhooks/providers/azure-devops.ts Webhook handler dispatches to trigger-specific event matchers; idempotency ID derived from subscriptionId+notificationId pair.
apps/sim/blocks/blocks/azure_devops.ts Comprehensive block configuration covering all 16 tools; normalizeDate helper correctly handles bare YYYY-MM-DD inputs.

Sequence Diagram

sequenceDiagram
    participant User as Sim Workflow
    participant Block as AzureDevOps Block
    participant Tool as Tool (e.g. query_work_items)
    participant ADO as Azure DevOps API

    User->>Block: Execute with operation + PAT
    Block->>Tool: Dispatch via tools.config.params()
    Tool->>ADO: POST /wit/wiql (WIQL query)
    ADO-->>Tool: workItems[] (IDs only)
    loop Chunks of 200 IDs
        Tool->>ADO: "GET /wit/workitems?ids=..."
        ADO-->>Tool: Full work item details
    end
    Tool-->>Block: content + metadata
    Block-->>User: Structured output

    Note over User,ADO: Webhook triggers (separate flow)
    ADO->>WebhookProvider: POST service hook payload
    WebhookProvider->>WebhookProvider: matchEvent() isAzureDevOpsEventMatch()
    WebhookProvider->>WebhookProvider: formatInput() formatBuildCompleteInput()
    WebhookProvider-->>User: Typed trigger output fields
Loading

Reviews (4): Last reviewed commit: "azure_devops: address more bugbot commen..." | Re-trigger Greptile

Comment thread apps/sim/tools/azure_devops/add_comment.ts
Comment thread apps/sim/lib/webhooks/providers/azure-devops.ts
Comment thread apps/sim/tools/azure_devops/list_builds.ts Outdated
waleedlatif1 and others added 2 commits May 19, 2026 12:40
- Add types barrel export to tools/azure_devops/index.ts
- Normalize comment endpoint path casing (/workItems/ -> /workitems/)
- Update test assertions to match normalized path
- Biome formatter reflow across tools, triggers, registry, and docs icon

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
- Fix bgColor #FFFFFF -> #0078D4 in integrations.json and triggers/azure_devops.mdx
- Bump File tool operationCount from 4 to 5 (Read, Fetch, Get, Write, Append)
- Apply .trim() to org/project across all 15 remaining tools (consistency with query_work_items)
- Fix Found ${data.count} -> Found ${data.count ?? items.length} fallback in list_builds, list_pipelines, list_pipeline_runs content strings

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
@waleedlatif1
Copy link
Copy Markdown
Collaborator Author

@greptile

@waleedlatif1
Copy link
Copy Markdown
Collaborator Author

@cursor review

Comment thread apps/sim/triggers/azure_devops/utils.ts Outdated
Comment thread apps/sim/tools/azure_devops/get_work_items_batch.ts
- triggers/utils: match build.complete result case-insensitively, accept stopped/cancelled in addition to failed/canceled/partiallySucceeded so PascalCase and legacy Azure DevOps payloads aren't dropped
- get_work_items_batch: chunk comma-separated IDs into 200-batch loops with proper status checks (was failing or returning incomplete data on >200 IDs)
- Add tests for both behaviors

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
@waleedlatif1
Copy link
Copy Markdown
Collaborator Author

@greptile

@waleedlatif1
Copy link
Copy Markdown
Collaborator Author

@cursor review

Comment thread apps/sim/blocks/blocks/azure_devops.ts
Comment thread apps/sim/tools/azure_devops/get_build_timeline.ts Outdated
- Block update_work_item now forwards areaPath; the Area Path subblock condition expanded to include update operation
- get_build_timeline.failedRecords now also flags partiallySucceeded and succeededWithIssues, normalized case-insensitively. Output description and added a focused test

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
@waleedlatif1
Copy link
Copy Markdown
Collaborator Author

@cursor review

Comment thread apps/sim/lib/webhooks/providers/azure-devops.ts
Comment thread apps/sim/tools/azure_devops/get_work_items_batch.ts
- Webhook provider extractIdempotencyId returns null when subscriptionId or notificationId is missing/empty, preventing the literal "azure_devops:undefined:undefined" key from collapsing unrelated deliveries into duplicates
- Get Work Items Batch validates that at least one non-empty ID is supplied before issuing the API request, throwing a clear error instead of hitting an empty ids= query
- Tests cover both behaviors

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
@waleedlatif1
Copy link
Copy Markdown
Collaborator Author

@greptile

@waleedlatif1
Copy link
Copy Markdown
Collaborator Author

@cursor review

@waleedlatif1 waleedlatif1 changed the title feat(azure-devops): integration (supersedes #4642 with validate-integration fixes) feat(azure-devops): block and trigger May 19, 2026
Copy link
Copy Markdown

@cursor cursor Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ Bugbot reviewed your changes and found no new issues!

Comment @cursor review or bugbot run to trigger another review on this PR

Reviewed by Cursor Bugbot for commit 41b172f. Configure here.

Microsoft's Add Comments docs only publish 7.0-preview.3 (the 7.2 view falls back to the 7.0 page). Get Comments stays on the documented 7.2-preview.4. Matches what's strictly in the Azure DevOps REST API reference rather than relying on undocumented version behavior.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
@waleedlatif1 waleedlatif1 merged commit df1e2dd into staging May 19, 2026
9 checks passed
@waleedlatif1 waleedlatif1 deleted the feat/azure-devops-integration branch May 19, 2026 21:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants